package com.abc.xxx.model;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Getter;
import lombok.Setter;

import java.time.LocalDateTime;

/**
 * created by CaiBaoHong at 2018/5/9 17:06<br>
 */
@Getter
@Setter
@TableName("t_sys_config")
public class SysConfig {

    /**
     * 设备在线时间阈值
     */
    public static final String DEVICE_ONLINE_THRESHOLD = "device_online_threshold";

    /**
     * 订阅平台名
     */
    public static final String NB_MSG_PLATFORM_NAME = "nb_msg_platform_name";
    /**
     * 订阅平台密码
     */
    public static final String NB_MSG_PLATFORM_PWD = "nb_msg_platform_pwd";
    /**
     * 订阅平台url
     */
    public static final String NB_MSG_PLATFORM_URL = "nb_msg_platform_url";
    /**
     * 华为应用id
     */
    public static final String NB_MSG_HUAWEI_APP_ID = "nb_msg_huawei_app_id";
    /**
     * 订阅模块url
     */
    public static final String SUBSCRIBER_URL = "subscriber_url";
    /**
     * 订阅模块token
     */
    public static final String SUBSCRIBER_TOKEN = "subscriber_token";
    /**
     * 订阅模块token过期时间
     */
    public static final String SUBSCRIBER_TOKEN_EXPIRED = "subscriber_token_expired";
    /**
     * 采集器模块url
     */
    public static final String COLLECTOR_URL = "collector_url";
    /**
     * 采集器模块token
     */
    public static final String COLLECTOR_TOKEN = "collector_token";
    /**
     * 采集器模块token过期时间
     */
    public static final String COLLECTOR_TOKEN_EXPIRED = "collector_token_expired";
    /**
     * 解析包上传路径
     */
    public static final String JAR_PATH = "jar_path";

    @TableId
    private Integer id;

    @TableField("`key`")
    private String key;

    @TableField("`val`")
    private String val;

    @TableField("`desc`")
    private String desc;

    @TableField("`updated`")
    private LocalDateTime updated;

    public String getKeyOrDefaultEmpty() {
        if (key == null) return "";
        return key;
    }

    public String getValOrDefaultEmpty() {
        if (val == null) return "";
        return val;
    }

}
